﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:SStuff.FlowControls">


    <Style TargetType="local:FlowItem2D">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:FlowItem2D">
				<Grid >
                		<VisualStateManager.VisualStateGroups>
                			<VisualStateGroup x:Name="SelectionStates">
                				<VisualStateGroup.Transitions>
                					<VisualTransition GeneratedDuration="0:0:0.3"/>
                				</VisualStateGroup.Transitions>
                				<VisualState x:Name="Selected">
                					<Storyboard>
                						<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="border">
                							<EasingColorKeyFrame KeyTime="0" Value="White"/>
                						</ColorAnimationUsingKeyFrames>
                						<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="border">
                							<EasingColorKeyFrame KeyTime="0" Value="White"/>
                						</ColorAnimationUsingKeyFrames>
                						<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="border">
                							<EasingColorKeyFrame KeyTime="0" Value="White"/>
                						</ColorAnimationUsingKeyFrames>
                					</Storyboard>
                				</VisualState>
                				<VisualState x:Name="Unselected"/>
                			</VisualStateGroup>
                			<VisualStateGroup x:Name="MouseStates">
                				<VisualStateGroup.Transitions>
                					<VisualTransition GeneratedDuration="0"/>
                					<VisualTransition GeneratedDuration="0:0:0.4" To="MouseOver">
                						<VisualTransition.GeneratedEasingFunction>
                							<CubicEase EasingMode="EaseInOut"/>
                						</VisualTransition.GeneratedEasingFunction>
                					</VisualTransition>
                					<VisualTransition GeneratedDuration="0:0:0.4" To="MouseOut">
                						<VisualTransition.GeneratedEasingFunction>
                							<CubicEase EasingMode="EaseIn"/>
                						</VisualTransition.GeneratedEasingFunction>
                					</VisualTransition>
                				</VisualStateGroup.Transitions>
                				<VisualState x:Name="MouseOver">
                					<Storyboard>
                						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="border">
                							<EasingDoubleKeyFrame KeyTime="0" Value="-10"/>
                						</DoubleAnimationUsingKeyFrames>
                						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="rectangle">
                							<EasingDoubleKeyFrame KeyTime="0" Value="12"/>
                						</DoubleAnimationUsingKeyFrames>
                					</Storyboard>
                				</VisualState>
                				<VisualState x:Name="MouseOut"/>
                			</VisualStateGroup>
                		</VisualStateManager.VisualStateGroups>
                		<Border x:Name="border" BorderBrush="#FF333333" BorderThickness="0" CornerRadius="4" Padding="4" RenderTransformOrigin="0.5,0.5">
                			<Border.Background>
                				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                					<GradientStop Color="#FF8B8B8B" Offset="0"/>
                					<GradientStop Color="#FFDADADA" Offset="1"/>
                					<GradientStop Color="#FFF3F3F3" Offset="0.536"/>
                				</LinearGradientBrush>
                			</Border.Background>
                		
                			<Border.RenderTransform>
                				<TransformGroup>
                					<ScaleTransform/>
                					<SkewTransform/>
                					<RotateTransform/>
                					<TranslateTransform/>
                				</TransformGroup>
                			</Border.RenderTransform>
                		
                			<ContentPresenter Content="{TemplateBinding Content}" 
                				ContentTemplate="{TemplateBinding ContentTemplate}" />
                		</Border>
                		<Rectangle x:Name="rectangle" Fill="{Binding Background, ElementName=border}" IsHitTestVisible="False" RadiusY="4" RadiusX="4" RenderTransformOrigin="0.5,1" >
                			<Rectangle.OpacityMask>
                				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                					<GradientStop Offset="0.388"/>
                					<GradientStop Color="#97FFFFFF" Offset="1"/>
                				</LinearGradientBrush>
                			</Rectangle.OpacityMask>
                			<Rectangle.RenderTransform>
                				<TransformGroup>
                					<ScaleTransform ScaleY="-0.7"/>
                					<SkewTransform/>
                					<RotateTransform/>
                					<TranslateTransform Y="2"/>
                				</TransformGroup>
                			</Rectangle.RenderTransform>
                		</Rectangle>
                	</Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:FlowItemsControl2D">
        <Setter Property="Template" >
            <Setter.Value>
                <ControlTemplate TargetType="local:FlowItemsControl2D">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <ItemsPresenter x:Name="ItemsPresenter" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <local:FlowPanel2D />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Background" Value="Transparent" />
    </Style>

    <Style TargetType="local:FlowItem3D">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:FlowItem3D">
                    <Grid>
                		<VisualStateManager.VisualStateGroups>
                			<VisualStateGroup x:Name="SelectionStates">
                				<VisualStateGroup.Transitions>
                					<VisualTransition GeneratedDuration="0:0:0.3"/>
                				</VisualStateGroup.Transitions>
                				<VisualState x:Name="Selected">
                					<Storyboard>
                						<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="border">
                							<EasingColorKeyFrame KeyTime="0" Value="White"/>
                						</ColorAnimationUsingKeyFrames>
                						<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="border">
                							<EasingColorKeyFrame KeyTime="0" Value="White"/>
                						</ColorAnimationUsingKeyFrames>
                						<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="border">
                							<EasingColorKeyFrame KeyTime="0" Value="White"/>
                						</ColorAnimationUsingKeyFrames>
                					</Storyboard>
                				</VisualState>
                				<VisualState x:Name="Unselected"/>
                			</VisualStateGroup>
                			<VisualStateGroup x:Name="MouseStates">
                				<VisualStateGroup.Transitions>
                					<VisualTransition GeneratedDuration="0"/>
                					<VisualTransition GeneratedDuration="0:0:0.4" To="MouseOver">
                						<VisualTransition.GeneratedEasingFunction>
                							<CubicEase EasingMode="EaseInOut"/>
                						</VisualTransition.GeneratedEasingFunction>
                					</VisualTransition>
                					<VisualTransition GeneratedDuration="0:0:0.4" To="MouseOut">
                						<VisualTransition.GeneratedEasingFunction>
                							<CubicEase EasingMode="EaseIn"/>
                						</VisualTransition.GeneratedEasingFunction>
                					</VisualTransition>
                				</VisualStateGroup.Transitions>
                				<VisualState x:Name="MouseOver">
                					<Storyboard>
                						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="border">
                							<EasingDoubleKeyFrame KeyTime="0" Value="-10"/>
                						</DoubleAnimationUsingKeyFrames>
                						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="rectangle">
                							<EasingDoubleKeyFrame KeyTime="0" Value="12"/>
                						</DoubleAnimationUsingKeyFrames>
                					</Storyboard>
                				</VisualState>
                				<VisualState x:Name="MouseOut"/>
                			</VisualStateGroup>
                		</VisualStateManager.VisualStateGroups>
                		<Border x:Name="border" BorderBrush="#FF333333" BorderThickness="0" CornerRadius="4" Padding="4" RenderTransformOrigin="0.5,0.5">
                			<Border.Background>
                				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                					<GradientStop Color="#FF8B8B8B" Offset="0"/>
                					<GradientStop Color="#FFDADADA" Offset="1"/>
                					<GradientStop Color="#FFF3F3F3" Offset="0.536"/>
                				</LinearGradientBrush>
                			</Border.Background>
                		
                			<Border.RenderTransform>
                				<TransformGroup>
                					<ScaleTransform/>
                					<SkewTransform/>
                					<RotateTransform/>
                					<TranslateTransform/>
                				</TransformGroup>
                			</Border.RenderTransform>
                		
                			<ContentPresenter Content="{TemplateBinding Content}" 
                				ContentTemplate="{TemplateBinding ContentTemplate}" />
                		</Border>
                		<Rectangle x:Name="rectangle" Fill="{Binding Background, ElementName=border}" IsHitTestVisible="False" RadiusY="4" RadiusX="4" RenderTransformOrigin="0.5,1" >
                			<Rectangle.OpacityMask>
                				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                					<GradientStop Offset="0.388"/>
                					<GradientStop Color="#97FFFFFF" Offset="1"/>
                				</LinearGradientBrush>
                			</Rectangle.OpacityMask>
                			<Rectangle.RenderTransform>
                				<TransformGroup>
                					<ScaleTransform ScaleY="-0.7"/>
                					<SkewTransform/>
                					<RotateTransform/>
                					<TranslateTransform Y="2"/>
                				</TransformGroup>
                			</Rectangle.RenderTransform>
                		</Rectangle>
                	</Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:FlowItemsControl3D">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:FlowItemsControl3D">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                    <ItemsPresenter x:Name="ItemsPresenter" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <local:FlowPanel3D />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Background" Value="Transparent" />
    </Style>

    <Style TargetType="local:InFlowContentControl">
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFBABABA" Offset="0"/>
                    <GradientStop Color="White" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="HeadingBackground">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0"/>
                    <GradientStop Color="White" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:InFlowContentControl">
                    <Grid >
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.4"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Unselected"/>
                                <VisualState x:Name="Selected"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="MouseStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.4"/>
                                    <VisualTransition GeneratedDuration="0:0:0.4" To="MouseOut">
                                        <VisualTransition.GeneratedEasingFunction>
                                            <BounceEase EasingMode="EaseOut"/>
                                        </VisualTransition.GeneratedEasingFunction>
                                    </VisualTransition>
                                    <VisualTransition GeneratedDuration="0:0:0.4" To="MouseOver">
                                        <VisualTransition.GeneratedEasingFunction>
                                            <CubicEase EasingMode="EaseOut"/>
                                        </VisualTransition.GeneratedEasingFunction>
                                    </VisualTransition>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="main">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="-15"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="reflection">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="15"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOut"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="main" RenderTransformOrigin="0.5,0.5">
                            <Grid.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </Grid.RenderTransform>
                            <Path Stretch="Fill" Data="F1 M 12,0.000183105L 138,0.000183105C 144.627,0.000183105 150,5.37276 150,12.0002L 150,138C 150,144.627 144.627,150 138,150L 12,150C 5.37258,150 0,144.627 0,138L 0,12.0002C 0,5.37276 5.37258,0.000183105 12,0.000183105 Z "  UseLayoutRounding="False"
                				Fill="{TemplateBinding Background}"/>
                            <Path Stretch="Fill" Data="F1 M 0,48.9271L 0,12C 0,5.37259 5.37258,1.52588e-005 12,1.52588e-005L 138,1.52588e-005C 144.627,1.52588e-005 150,5.37259 150,12L 150,48.9271C 124,38.8438 26.8125,39.2604 0,48.9271 Z "  Height="48.927" UseLayoutRounding="False" VerticalAlignment="Top" 
                				Fill="{TemplateBinding HeadingBackground}"/>
                            <Path Stretch="Fill" Data="F1 M 13.5,2.27919L 136.5,2.27919C 143.127,2.27919 148.5,7.65176 148.5,14.2792L 148.5,17.6477C 148.5,24.2751 143.127,29.6477 136.5,29.6477L 13.5,29.6477C 6.87262,29.6477 1.50003,24.2751 1.50003,17.6477L 1.50003,14.2792C 1.50003,7.65176 6.87262,2.27919 13.5,2.27919 Z " Height="27.369" Margin="1.5,2.279,1.5,0" UseLayoutRounding="False" VerticalAlignment="Top">
                                <Path.Fill>
                                    <LinearGradientBrush StartPoint="0.518889,-0.00261203" EndPoint="0.518889,1.00597">
                                        <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                        <GradientStop Color="#00FFFFFF" Offset="0.134884"/>
                                    </LinearGradientBrush>
                                </Path.Fill>
                            </Path>
                            <ContentControl Height="31" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
                				Content="{TemplateBinding Heading}" ContentTemplate="{TemplateBinding HeadingTemplate}" Margin="0,7,0,0"/>
                            <ContentControl x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="0,50,0,0" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="{TemplateBinding Foreground}"/>
                        </Grid>
                        <Path x:Name="reflection" Stretch="Fill" Data="F1 M 12,0.000183105L 138,0.000183105C 144.627,0.000183105 150,5.37276 150,12.0002L 150,138C 150,144.627 144.627,150 138,150L 12,150C 5.37258,150 0,144.627 0,138L 0,12.0002C 0,5.37276 5.37258,0.000183105 12,0.000183105 Z "  UseLayoutRounding="False" RenderTransformOrigin="0.5,1"
                			Fill="{TemplateBinding Background}" Margin="0,0,0,-5" IsHitTestVisible="False">
                            <Path.OpacityMask>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#7F000000" Offset="1"/>
                                    <GradientStop Color="Transparent" Offset="0.451"/>
                                </LinearGradientBrush>
                            </Path.OpacityMask>
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleY="-0.7"/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </Path.RenderTransform>

                        </Path>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

    </Style>
</ResourceDictionary>
